﻿using AutoMapper.Internal.Mappers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;

namespace Himp.TaskScheduling
{
    public class WorkflowJobService : ISingletonDependency
    {
        private readonly IBackgroundJobManager _backgroundJobManager;
        private IRepository<ParamConfig, long> _paramConfigRepository;

        public WorkflowJobService(IBackgroundJobManager backgroundJobManager
            , IRepository<ParamConfig, long> paramConfigRepository)
        {
            _backgroundJobManager = backgroundJobManager;
            _paramConfigRepository = paramConfigRepository;
        }

        public async Task InitData()
        {
            var paramConfigList = await  _paramConfigRepository.GetListAsync();

            await _backgroundJobManager.EnqueueAsync(
                new WorkflowArgs
                {
                    ParamConfigs = new List<ParamConfigDto>()
                }
            );
        }
    }
}
